export default {
  props: {
    type: {
      type: null,
      default: 'home'
    },
    tab_type: {
      type: null,
      default: '大厅'
    },
    mobile: {
      type: null,
      default: ''
    },
    order_id: {
      type: null,
      default: ''
    },
    //用于技能详情跳转预订单
    skillService: {
      type: null,
      default: () => {}
    }
  },
  data() {
    return {
    };
  },
  mounted() {
    console.log(this.mobile,this.skillService,211111)
  },
  methods: {
    chooseType(val) {
      switch (val) {
        case '订单':
          this.$router.push(
            this.fun.getUrl("anyOrderIndex", {})
          );
          break;
        case '大厅':
            this.$router.push(
              this.fun.getUrl("anytimeService", {})
            );
            break;
        case '我的':
              this.$router.push(
                this.fun.getUrl("anytimeMy", {})
              );
              break;
        case '发布需求':
              this.check_apply(1);
              break;
        case '技能需求':
              this.check_apply(2);
              break;
        default:
          break;
      }
    },
    async check_apply(role){
      let { result, msg, data } = await $http.get("plugin.be-within-call.frontend.role-apply.detail", { role}, '');
      if (result) {
        if (data.apply_status !== 1) {
          if(role==1){
            this.$router.push(this.fun.getUrl("anytimeRoleApply", { apply_for_type: 1 }))
          }else{
            this.$router.push(this.fun.getUrl("anytimeRoleApply", { apply_for_type: 2 }))

          }
        }else{
          if(role==1){
            this.$router.push(
              this.fun.getUrl("anytimeDemand", {type: 1})
            );
          }else{
            this.$router.push(
              this.fun.getUrl("anytimeSkillMasterManage", {})
            );
          }
        }
      } else {
        this.$toast(msg);
      }
    },
    tabAppointment() {
      this.$router.push(
        this.fun.getUrl("anyOrder", {id: this.skillService.id})
      );
    },
    //个人需求- 抢单
    receive() {
      $http.get("plugin.be-within-call.frontend.need-order-operate.grab", {oid:this.order_id }).then(({ data , result , msg }) => {
        this.$toast(msg);
        if(result) {
          this.$router.push(
            this.fun.getUrl("anytimeAreaOrder", {})
          );
        }
      });
    },
  },
  components: {  }
};
